package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BibliotecaApp {

    public static void main(String[] args) {
        Application mainApp = Application.getApp();
        System.out.println(mainApp.welcomeMessage());
        for (String option : mainApp.menuOptions()) {
            System.out.println(option);
        }

        InputStreamReader inputStreamReader = new InputStreamReader(System.in);
        BufferedReader bufRead = new BufferedReader(inputStreamReader);
        Boolean running = true;
        while (running) {
            try {
                System.out.println("Please Select an option:");
                String textInput = bufRead.readLine();
                int IntegerChoice = Integer.parseInt(textInput);
                running = mainApp.checkForExitInstruction(running, IntegerChoice);
                mainApp.execute(mainApp.selectOption(IntegerChoice));

            } catch (IOException err) {

            }
        }


    }


}
